home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 3: The Continuation / 17-Bit_The_Continuation_Disc.iso / amigan / amigan 8 / _main.c next >
C/C++ Source or Header  |  1994-01-27  |  2KB  |  82 lines

  1. #include "lattice/stdio.h"
  2. #include "lattice/ctype.h"
  3. #include "lattice/ios1.h"
  4.  
  5. #include "workbench/startup.h"
  6. #include "libraries/dos.h"
  7.  
  8. #define MAXARG 32              /* maximum command line arguments */
  9.  
  10. #ifndef TINY
  11. extern int _stack,_fmode,_iomode;
  12. #endif
  13. extern int LoadAddress;
  14.  
  15. extern struct UFB _ufbs[];
  16. int argc;            /* arg count */
  17. char *argv[MAXARG];        /* arg pointers */
  18.  
  19. #define MAXWINDOW 40
  20. extern struct WBStartup *WBenchMsg;
  21. static char window[MAXWINDOW] = "con:10/10/320/80/";
  22.  
  23. /**
  24. *
  25. * name         _main - process command line, open files, and call "main"
  26. *
  27. * synopsis     _main(line);
  28. *              char *line;     ptr to command line that caused execution
  29. *
  30. * description    This function performs the standard pre-processing for
  31. *        the main module of a C program.  It accepts a command
  32. *        line of the form
  33. *
  34. *            pgmname arg1 arg2 ...
  35. *
  36. *        and builds a list of pointers to each argument.  The first
  37. *        pointer is to the program name.  For some environments, the
  38. *        standard I/O files are also opened, using file names that
  39. *        were set up by the OS interface module XCMAIN.
  40. *
  41. **/
  42. _main(line)
  43. char *line;
  44. {
  45. char c;
  46. int x;
  47.  
  48. /*
  49. *
  50. * Build argument pointer list
  51. *
  52. */
  53. for(argc = 0; argc < MAXARG; )
  54.     {
  55.     while(isspace(*line)) line++;
  56.     if(*line == '\0') break;
  57.     argv[argc++] = line;
  58.     while((*line != '\0') && (isspace(*line) == 0)) line++;
  59.     c = *line;
  60.     *line++ = '\0';
  61.     if(c == '\0') break;
  62.     }
  63.  
  64. _ufbs[0].ufbflg |= UFB_OP | UFB_RA | UFB_NC;
  65. _ufbs[1].ufbflg |= UFB_OP | UFB_WA | UFB_NC;
  66. _ufbs[2].ufbflg |= UFB_OP | UFB_WA ;
  67.  
  68. /*
  69. *
  70. * Call user's main program
  71. *
  72. */
  73. #ifdef DEBUG
  74. printf("load address = %lx\n",LoadAddress);
  75. Debug(0);
  76. #endif
  77.  
  78. main(argc,argv);              /* call main function */
  79. _exit(0);
  80. }
  81.  
  82.